package com.hong.controller.v1;

import com.hong.model.InMessage;
import com.hong.model.OutMessage;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

/**
 * @Author csh
 * @Description
 * @Date 2018/9/13 22:06
 */
@Controller
public class GameInfoController {
    /**
     * MessageMapping 跟requestMapping类似但是messageMapping是针对websocket
     * SendTo 发送给指定的客户
     * */
    @MessageMapping("/v1/chat")
    @SendTo("/topic/game_chat")
    public OutMessage gameInfo(InMessage inMessage){
        System.out.println("OutMessage");
        return new OutMessage(inMessage.getContent());
    }
}
